import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import VueDevTools from 'vite-plugin-vue-devtools'
//varlet ui 组件库
import components from 'unplugin-vue-components/vite'
import autoImport from 'unplugin-auto-import/vite'
import { VarletImportResolver } from '@varlet/import-resolver'
//varlet icon 插件
import icon from '@varlet/unplugin-icon-builder/vite'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    icon(), //varlet 的图标
    vue(),
    vueJsx(),
    VueDevTools(),
    components({
      resolvers: [VarletImportResolver()] //varlet
    }),
    autoImport({
      resolvers: [
        VarletImportResolver({
          autoImport: true
        }) //varlet
      ]
    })
  ],
  server: {
    host: '0.0.0.0'
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})
